
<?php
$this->load->view('includes/header');
$this->load->view('includes/nav');
?>
<div id='fb-root'></div>
<script src='http://connect.facebook.net/en_US/all.js'></script>
<script src="<?php echo base_url(); ?>public/js/lp_photos.js"></script>
<section id="LeapMainWrapper">
    <section id="LeapContentWrapper">
        <section class="photoStream singlephotoStream">
                <div class="photohead singlephotoHead">
                    <div class="userInfos" id="<?php echo $user['user_id'] ?>">
                        <div class="photoInfos">
                            <div class="profileP">
                                <img src="<?php echo $user['profile_pic'] ?>" alt="<?php echo $user['first_name'] . " " . $user['last_name'] ?>" width="50px"/>
                                <p class="name"><a href="/<?php echo $user['username'] ?>"><?php echo $user['first_name'] . " " . $user['last_name'] ?></a></p>
                                <p class="addedtime"><?php echo isset($photo_infos['uploaded']) ? $photo_infos['uploaded'] : ""; ?></p>
                            </div>
                        </div>
                        <?php if($connected){ if($user['user_id'] !== $user_id){ ?>
                        <span class="button <?php if ($isFollowing)
                echo "fl"; else
                echo "follow"; ?>"><?php if ($isFollowing)
                echo "Unfollow"; else
                echo "Follow"; ?>
                        </span>
                        <?php }} ?>
                        <div class="clearfix"></div>
                    </div>
                    <div class="original_photographer">
                        <p class="photographer">
                        <?php echo $photo_infos['photograph']; ?>
                        </p>
                    </div>
                </div>
                <article class="photos singlephoto">
                    <div class="mediaHolder">
                        <a class="photoPost" id="<?php echo $photo_infos['photo_id']; ?>" href="/<?php echo $photo_infos['photo_id']; ?>">
                            <img class="imgThumbPost" alt="<?php echo $photo_infos['title']; ?>" src="<?php echo $photo_infos['source']; ?>">
                            <i></i>
                        </a>
                    </div>
                    <h4 class="title"><a href="photos/<?php echo $photo_infos['photo_id']; ?>"><?php echo $photo_infos['title']; ?></a></h4>
                    <p class="description"><?php echo $photo_infos['description']; ?></p>
        <!--            <p class="uploadDate"><?php echo isset($photo_infos['uploaded']) ? $photo_infos['uploaded'] : ""; ?></p>-->
                    <div class="extendWrapper">
                        <div class="extendAction">
                            <ul id="<?php echo $photo_infos['photo_id']; ?>">
                                <li class="VinfoList">
                                    <div class="commentsCount" >
                                     <span><?php echo count($comments); ?></span>           
                                    </div>
                                </li>
                                <li class="VinfoList">

                                    <?php
                                    echo '<div id="likephoto" ';
                                    if ($did_like)
                                        echo 'class="likeCount_f">';
                                    else
                                        echo 'class="likeCount">';
                                    echo $likes;
                                    echo "</div>";
                                    ?>          

                                </li>
                                <li class="VinfoList">
                                    <?php
                                    echo '<div id="Favphoto" ';
                                    if ($did_fav)
                                        echo 'class="FavCount_f">';
                                    else
                                        echo 'class="FavCount">';
                                    echo $favs;
                                    echo "</div>";
                                    ?> 
                                </li>
                                <li class="VinfoList shareTo">
                                    <div class="shareMedia">
                                    </div>
                                    <ul id="sharephoto" class="dropdown-menu">
                                            <li id="shareFacebook">share to Facebook</li>
                                            <li id="shareTwitter">share to Twitter</li>
                                            <li id="shareEmail">Email Message</li>
                                        </ul>
                                </li>
                            </ul>
                        </div>
                        <div class="clearfix"></div>
                        <div class="extendphoto" id="<?php echo $photo_infos['photo_id']; ?>">
                            <div class="commentsWrapper">
    <?php if ($connected) { ?>
                                    <div class="photocomment">
                                        <div class="commentProfilePic">

                                            <span class="profilePicphoto" ><img src="<?php echo $profile_pic_thumb; ?>" width="30" height="30" /></span>
                                        </div>
                                        <div class="photoCommentBody">
                                            <textarea class="comment" placeholder="Add comment..."></textarea>
                                        </div>
                                        <div class="clearfix"></div>
                                    </div>
                                        <?php } ?>
                                <div class="commentstream singleStream">
                                    <ul>
                                        <?php foreach ($comments as $k => $val) { ?>
                                            <li>
                                                <span class="profilePicphoto" ><img src="<?php echo $val['user_profile_pic_thumb']; ?>" width="30" height="30" /></span>
                                                <div class="commentInfos">
                                                    <p class="user_name"><a href="<?php echo $val['user_name']; ?>"><?php echo $val['user_name']; ?></a></p>
                                                    <p class="added"><?php echo $val['timestamp']; ?></p>
                                                </div>
                                                <p class="comment_"><?php echo $val['comment']; ?></p>
                                                <div class="clearfix">
                                                </div>
                                            </li>
                                         <?php } ?>
                                    </ul>
                                </div>

                            </div>
                        </div>
                    </div>
                    <div class="clearfix"></div>
                </article>
        </section>
    </section>
<?php $this->load->view('includes/sidebar'); ?> 

</section>

<script>
    $.lp.init();
</script>
<?php
$this->load->view('includes/footer');
?>